package com.tongji.diy.view
{
	import com.tongji.diy.event.ChangeShapeEvent;
	import com.tongji.diy.view.ScrollingWallContent;
	
	import flash.events.MouseEvent;
	
	import org.robotlegs.mvcs.Mediator;
	
	import spark.components.Group;
	
	public class ScrollingWallMediator extends Mediator
	{
		[Inject]
		public var view:ScrollingWallContent;
		
		override public function onRegister():void
		{
			view.addEventListener(MouseEvent.MOUSE_DOWN, listMouseDownHandler);
		}
		
		private function listMouseDownHandler(event:MouseEvent):void
		{
			switch (view.getChildIndex(event.target as Group))
			{
				case 0:
					dispatch(new ChangeShapeEvent(ChangeShapeEvent.CHANGE_SHAPE_ARC));
					break;
				case 1:
					dispatch(new ChangeShapeEvent(ChangeShapeEvent.CHANGE_SHAPE_LWALL));
					break;
				case 2:
					dispatch(new ChangeShapeEvent(ChangeShapeEvent.CHANGE_SHAPE_RECT));
					break;
			}
		}
	}
}